﻿@model eduscrum.ViewModels.ProjectVM
@using eduscrum.ViewModels
@using System.Web.Mvc;
@{
    HtmlHelper.ClientValidationEnabled = true;
    HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
    ViewContext.ClientValidationEnabled = true;
    ViewContext.UnobtrusiveJavaScriptEnabled = true;
}
<div id="content">
    <div id="contentcontainer">
        <fieldset id="projectDetails">
            <legend>@Model.Name</legend>
            <span class="closex">@Html.ActionLink("x", "Index", "Project")</span>
            @using (Html.BeginForm("Edit", "Project", FormMethod.Post))
            {
                @Html.ValidationSummary(true)
                @Html.HiddenFor(model => model.ProjectID)
                @Html.HiddenFor(model => model.PhaseCount)

                <h2>General Settings</h2>
                <table>
                    <tr>
                        <td>@Html.LabelFor(model => model.Locked)</td>
                        <td>@Html.EditorFor(model => model.Locked)</td>
                        <td>@Html.ValidationMessageFor(model => model.Locked)</td>
                    </tr>
                    <tr>
                        <td>@Html.LabelFor(model => model.Name)</td>
                        <td>@Html.TextBoxFor(model => model.Name)</td>
                        <td>@Html.ValidationMessageFor(model => model.Name)</td>
                    </tr>
                    <tr>
                        <td>@Html.LabelFor(model => model.StartDate)</td>
                        <td>@Html.TextBoxFor(model => model.StartDate, new { @id = "datepickerProjectStart", @Value = Model.StartDate.ToString("dd-MM-yyyy"), @readonly = "readonly" })</td>
                        <td>@Html.ValidationMessageFor(model => model.StartDate)</td>
                    </tr>
                    <tr>
                        <td>@Html.LabelFor(model => model.EndDate)</td>
                        <td>@Html.TextBoxFor(model => model.EndDate, new { @id = "datepickerProjectEnd", @Value = Model.EndDate.ToString("dd-MM-yyyy"), @readonly = "readonly" })</td>
                        <td>@Html.ValidationMessageFor(model => model.EndDate)</td>
                    </tr>
                    <tr>
                        <td>@Html.LabelFor(model => model.SprintDuration)</td>
                        <td>@Html.TextBoxFor(model => model.SprintDuration)</td>
                        <td>@Html.ValidationMessageFor(model => model.SprintDuration)</td>
                    </tr>
                    
                    <tr>
                        <td align="right" colspan="2">
                            <input type="image" src="@Url.Content("~/images/save.png")" alt="Save" title="Save" />
                            <img onclick="deleteItem('project', '@Url.Action("Delete", new { id = Model.ProjectID })')" src="@Url.Content("~/images/delete.png")" title="Delete" alt="Delete" class="icon" />
                        </td>
                    </tr>
                </table>
            }
        </fieldset>
        <fieldset id="phaseslist">
            @{
                var vd = new ViewDataDictionary(this.ViewData);
                Html.RenderPartial("~/Views/Phase/IndexProject.cshtml", Model.Phases, vd);
            }
        </fieldset>
        <fieldset id="productbacklog">
            @{
                Html.RenderPartial("~/Views/UserStory/IndexProject.cshtml", Model.Backlog, vd);
            }
        </fieldset>
        <fieldset id="sprints">
            @{
                Html.RenderPartial("~/Views/Sprint/IndexProject.cshtml", Model.Sprints, vd);
            }
        </fieldset>
    </div>
</div>
<script type="text/javascript" language="javascript">
    $('form').removeData('validator');
    $('form').removeData('unobtrusiveValidation');
    $.validator.unobtrusive.parse('form');
</script>
